using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FrameWork.Source.FrameWork;
using FrameWork.Source.Resource_Manager;
using FrameWork.Source.Texture;
using Microsoft.Xna.Framework;
using FrameWork.Source.Global_variables;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Audio;
using Boomer.Source.FrameWork.State_and_Screen_Manager.Screen_Manager;
using Boomer.Source.FrameWork.State_and_Screen_Manager.State.MainState.MainScreen;

namespace FrameWork.Source.Screen
{
    class MainGameState : IGameState
    {
        ScreenManager m_pManager;

        public MainGameState(StateManager pState)
            : base(pState)
        {
            m_pManager = new ScreenManager(m_pState);

            m_pManager.addScreen(new MainGameScreen(0, "maingame", false, m_pManager));
            m_pManager.addScreen(new MenuIngameScreen(1, "menu", false, m_pManager));
        }


        public override void init()
        {
            CResourceManager.getInstance().loadImage(CResourceManager.RES_STATE.RES_STATE_MAIN, m_pState);
            m_pManager.init();

            m_pManager.setScreen("maingame", false , true);

            base.init();
        }

        public override void update(GameTime gameTime)
        {
            m_pManager.update(gameTime.ElapsedGameTime.Milliseconds / 1000.0f);
            base.update(gameTime);
        }

        public override void render(GameTime gameTime)
        {
            //m_pState.m_pSpriteHandler.Begin(SpriteSortMode.FrontToBack , BlendState.AlphaBlend);
            //render codes
            m_pManager.render();
            //m_pState.m_pSpriteHandler.End();
            base.render(gameTime);
        }

        public override void destroy()
        {
            base.destroy();
        }
    }
}
